package jp.joogoo.web.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2010-11-03 21:04:21")
/** */
public final class T_newMeta extends org.slim3.datastore.ModelMeta<jp.joogoo.web.model.T_new> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new> author = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new>(this, "author", "author");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new> contentUrl = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new>(this, "contentUrl", "contentUrl");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, java.util.Date> createdAt = new org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, java.util.Date>(this, "createdAt", "createdAt", java.util.Date.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.ModelRefAttributeMeta<jp.joogoo.web.model.T_new, org.slim3.datastore.ModelRef<jp.joogoo.web.model.M_joogoo>, jp.joogoo.web.model.M_joogoo> mJoogooRef = new org.slim3.datastore.ModelRefAttributeMeta<jp.joogoo.web.model.T_new, org.slim3.datastore.ModelRef<jp.joogoo.web.model.M_joogoo>, jp.joogoo.web.model.M_joogoo>(this, "mJoogooRef", "mJoogooRef", org.slim3.datastore.ModelRef.class, jp.joogoo.web.model.M_joogoo.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new> newText = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new>(this, "newText", "newText");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new> title = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new>(this, "title", "title");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, java.util.Date> updatedAt = new org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, java.util.Date>(this, "updatedAt", "updatedAt", java.util.Date.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new> userId = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.T_new>(this, "userId", "userId");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.T_new, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final org.slim3.datastore.ModificationDate slim3_updatedAtAttributeListener = new org.slim3.datastore.ModificationDate();

    private static final T_newMeta slim3_singleton = new T_newMeta();

    /**
     * @return the singleton
     */
    public static T_newMeta get() {
       return slim3_singleton;
    }

    /** */
    public T_newMeta() {
        super("T_new", jp.joogoo.web.model.T_new.class);
    }

    @Override
    public jp.joogoo.web.model.T_new entityToModel(com.google.appengine.api.datastore.Entity entity) {
        jp.joogoo.web.model.T_new model = new jp.joogoo.web.model.T_new();
        model.setAuthor((java.lang.String) entity.getProperty("author"));
        model.setContentUrl((java.lang.String) entity.getProperty("contentUrl"));
        model.setCreatedAt((java.util.Date) entity.getProperty("createdAt"));
        model.setKey(entity.getKey());
        if (model.getMJoogooRef() == null) {
            throw new NullPointerException("The property(mJoogooRef) is null.");
        }
        model.getMJoogooRef().setKey((com.google.appengine.api.datastore.Key) entity.getProperty("mJoogooRef"));
        model.setNewText((java.lang.String) entity.getProperty("newText"));
        model.setTitle((java.lang.String) entity.getProperty("title"));
        model.setUpdatedAt((java.util.Date) entity.getProperty("updatedAt"));
        model.setUserId((java.lang.String) entity.getProperty("userId"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        jp.joogoo.web.model.T_new m = (jp.joogoo.web.model.T_new) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("author", m.getAuthor());
        entity.setProperty("contentUrl", m.getContentUrl());
        entity.setProperty("createdAt", m.getCreatedAt());
        if (m.getMJoogooRef() == null) {
            throw new NullPointerException("The property(mJoogooRef) must not be null.");
        }
        entity.setProperty("mJoogooRef", org.slim3.datastore.ModelMeta.assignKeyIfNecessary(m.getMJoogooRef().getModelMeta(), m.getMJoogooRef().getModel()));
        entity.setProperty("newText", m.getNewText());
        entity.setProperty("title", m.getTitle());
        entity.setProperty("updatedAt", m.getUpdatedAt());
        entity.setProperty("userId", m.getUserId());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        jp.joogoo.web.model.T_new m = (jp.joogoo.web.model.T_new) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        jp.joogoo.web.model.T_new m = (jp.joogoo.web.model.T_new) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        jp.joogoo.web.model.T_new m = (jp.joogoo.web.model.T_new) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void incrementVersion(Object model) {
        jp.joogoo.web.model.T_new m = (jp.joogoo.web.model.T_new) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
        assignKeyIfNecessary(model);
        incrementVersion(model);
        jp.joogoo.web.model.T_new m = (jp.joogoo.web.model.T_new) model;
        m.setUpdatedAt(slim3_updatedAtAttributeListener.prePut(m.getUpdatedAt()));
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

}